<?php
namespace app\index\controller;
use app\index\controller\Base;
use think\Request;

class Search extends Base
{
    public function lst()
    {
        if(Request::instance()->isPost()){
            $data = db('article')->where('title','like','%'.input('keyword').'%')->order('id desc')->paginate(8);
        }elseif (input('tagtitle')) {
        	$data = db('article')->where('tag','like','%'.input('tagtitle').'%')->order('id desc')->paginate(8);
        }else{
        	
            $data = db('article')->order('id desc')->paginate(8);
        }
        $pagef=$data->render();
        $this->assign('search',$data);
        $this->assign('page', $pagef);
        return view();
    }
}
